<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button id="button">12</button>
</body>

</html>

<script>

    console.log(1);
    function async() {
        console.log(2);
        //await console.log(3); //await  看成promise.then
        Promise.resolve().then(() => {
            console.log(3);
        })
        console.log(4)
    }
    setTimeout(() => {
        console.log(5);
    }, 0);
    const promise = new Promise((resolve, reject) => {
        console.log(6);
        resolve(7)
    })
    promise.then(res => {
        console.log(res)
    })
    async();
    console.log(8);

// 宏任务:[s1,]
// 微任务:[then, async 3]

//1 , 6, 2 , 4 ,8, 7, 3 ,5

</script>